const app = getApp()
const router = require('../../../utils/router.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    Custom: app.globalData.Custom,
    scrollTop: 0,
    filters: [
      {
        title: '全部',
        name: 'all'
      },
      {
        title: '新品',
        name: 'new'
      }, {
        title: '销量',
        name: 'salesVolume'
      },
      {
        title: '价格',
        name: 'price',
        sort: true
      }
    ],
    goodsList: [
      {
        RealGoodsID: 0,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 1,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 2,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 3,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 4,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 5,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 6,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      },
      {
        RealGoodsID: 7,
        LogoImg: 'http://img4.imgtn.bdimg.com/it/u=2045592709,2048246775&fm=26&gp=0.jpg',
        RealGoodsName: '玛格全屋定制现代简约玛格全屋定制现代简约'
      }
    ]
  },
  itemClick({ detail }) {
    router.push(`/pages/goods/detail/detail?goodsID=${detail}`)
  },
  tapNavigateToUrl({ currentTarget }) {
    router.push(currentTarget.dataset.url)
  },
  filterChange(option) {
    console.log(option.detail)
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  onPageScroll(option) {
    this.setData({
      scrollTop: option.scrollTop
    })
  }
})